package com.ssy.lingxi.purchase.api.enums.bidding;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 采购竞价单操作枚举
 * @author lxc
 * @date 2022/3/11
 */
public enum BiddingOperationStateEnum {
    CANCEL(-1, "作废"),
    COMPLETE(99, "已完成"),
    ADD(1, "新增采购竞价单"),
    UPDATE(2, "修改采购竞价单"),
    SUBMIT_AUDIT_BIDDING(3, "提交审核采购竞价单"),
    AUDIT_BIDDING1(4, "审核采购竞价单(一级)"),
    AUDIT_BIDDING2(5, "审核采购竞价单(二级)"),
    SUBMIT_BIDDING(6, "提交采购竞价单"),
    BIDDING_ONLINE(7, "竞价报名"),
    BIDDING_HAS_RE_SIGNED_UP(8, "重新竞价报名"),
    AUDIT_BIDDING_ONLINE(9, "审核竞价报名"),
    BIDDING(10, "竞价"),
    ADMINISTRATION_BIDDING(11, "管理竞价"),
    SUBMIT_BIDDING_RESULT(12, "提交审核竞价结果"),
    AUDIT_BIDDING_RESULT1(13, "审核竞价结果(一级)"),
    AUDIT_BIDDING_RESULT2(14, "审核竞价结果(二级)"),
    CONFIRM_BIDDING_RESULT(15, "确认竞价结果"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public String getCHName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    BiddingOperationStateEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        BiddingOperationStateEnum workEnum = Arrays.stream(BiddingOperationStateEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(BiddingOperationStateEnum.class, workEnum.getState());
    }
}
